<template>
	<view class="my-feedback">
		<van-cell value="" icon="shop-o" is-link @click="cellClick(item.handleOpinion, item.isHandled)"
			v-for="(item,index) in feedbackList" :key="index">
			<view slot="title">
				<view class="van-cell-text">{{item.actTitle}}</view>
				<van-tag type="danger" v-if="!item.isHandled">未处理</van-tag>
				<van-tag type="success" v-else>已处理</van-tag>
				<view class="feedback-text">
					{{item.feedback}}
				</view>
			</view>
		</van-cell>
		<van-dialog id="van-dialog" />
	</view>
</template>

<script>
	import Dialog from '../../wxcomponents/@vant/weapp/dialog/dialog';
	import {
		getFeedbackList
	} from '@/config/api.js'
	import {
		mapState,
		mapGetters,
		mapActions
	} from 'vuex'
	export default {
		data() {
			return {
				feedbackList: []
			}
		},
		computed: {
			...mapGetters([
				'name',
				'account'
			])
		},
		methods: {
			async getFeedbackListFn() {
				console.log(111);
				const res = await getFeedbackList({
					params: {
						userAccount: this.account
					}
				})
				if (res.hasOk) {
					this.feedbackList = res.data
					console.log(this.feedbackList);
				}
			},
			cellClick(handleOpinion, isHandled) {
				if (!isHandled) {
					handleOpinion = "请等待活动举办方处理"
				}
				Dialog.alert({
					title: '反馈处理意见',
					message: handleOpinion,
				}).then(() => {
					// on close
				});
			},
			onShow() {
				console.log(222);
				this.getFeedbackListFn()
			}
		},

	}
</script>

<style lang="scss" scoped>

</style>